# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Compute.V1.Model.BfdStatus do
  @moduledoc """
  Next free: 15

  ## Attributes

  *   `bfdSessionInitializationMode` (*type:* `String.t`, *default:* `nil`) - The BFD session initialization mode for this BGP peer. If set to ACTIVE, the Cloud Router will initiate the BFD session for this BGP peer. If set to PASSIVE, the Cloud Router will wait for the peer router to initiate the BFD session for this BGP peer. If set to DISABLED, BFD is disabled for this BGP peer.
  *   `configUpdateTimestampMicros` (*type:* `String.t`, *default:* `nil`) - Unix timestamp of the most recent config update.
  *   `controlPacketCounts` (*type:* `GoogleApi.Compute.V1.Model.BfdStatusPacketCounts.t`, *default:* `nil`) - Control packet counts for the current BFD session.
  *   `controlPacketIntervals` (*type:* `list(GoogleApi.Compute.V1.Model.PacketIntervals.t)`, *default:* `nil`) - Inter-packet time interval statistics for control packets.
  *   `localDiagnostic` (*type:* `String.t`, *default:* `nil`) - The diagnostic code specifies the local system's reason for the last change in session state. This allows remote systems to determine the reason that the previous session failed, for example. These diagnostic codes are specified in section 4.1 of RFC5880
  *   `localState` (*type:* `String.t`, *default:* `nil`) - The current BFD session state as seen by the transmitting system. These states are specified in section 4.1 of RFC5880
  *   `negotiatedLocalControlTxIntervalMs` (*type:* `integer()`, *default:* `nil`) - Negotiated transmit interval for control packets.
  *   `rxPacket` (*type:* `GoogleApi.Compute.V1.Model.BfdPacket.t`, *default:* `nil`) - The most recent Rx control packet for this BFD session.
  *   `txPacket` (*type:* `GoogleApi.Compute.V1.Model.BfdPacket.t`, *default:* `nil`) - The most recent Tx control packet for this BFD session.
  *   `uptimeMs` (*type:* `String.t`, *default:* `nil`) - Session uptime in milliseconds. Value will be 0 if session is not up.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :bfdSessionInitializationMode => String.t() | nil,
          :configUpdateTimestampMicros => String.t() | nil,
          :controlPacketCounts => GoogleApi.Compute.V1.Model.BfdStatusPacketCounts.t() | nil,
          :controlPacketIntervals => list(GoogleApi.Compute.V1.Model.PacketIntervals.t()) | nil,
          :localDiagnostic => String.t() | nil,
          :localState => String.t() | nil,
          :negotiatedLocalControlTxIntervalMs => integer() | nil,
          :rxPacket => GoogleApi.Compute.V1.Model.BfdPacket.t() | nil,
          :txPacket => GoogleApi.Compute.V1.Model.BfdPacket.t() | nil,
          :uptimeMs => String.t() | nil
        }

  field(:bfdSessionInitializationMode)
  field(:configUpdateTimestampMicros)
  field(:controlPacketCounts, as: GoogleApi.Compute.V1.Model.BfdStatusPacketCounts)
  field(:controlPacketIntervals, as: GoogleApi.Compute.V1.Model.PacketIntervals, type: :list)
  field(:localDiagnostic)
  field(:localState)
  field(:negotiatedLocalControlTxIntervalMs)
  field(:rxPacket, as: GoogleApi.Compute.V1.Model.BfdPacket)
  field(:txPacket, as: GoogleApi.Compute.V1.Model.BfdPacket)
  field(:uptimeMs)
end

defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.BfdStatus do
  def decode(value, options) do
    GoogleApi.Compute.V1.Model.BfdStatus.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.BfdStatus do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
